package com.igeek.d0619.test3;

/**
 * @Author: zhiyu
 * @Date:17:46
 * @DESC:
 */
public class Test {
    public static void main(String[] args) {
        System.out.println("=========================通过proxy实现动态代理=============================");
        Calculator target = new Calculator();
        CglibProxy cglibProxy = new CglibProxy(target);
        Calculator proxy = cglibProxy.getProxy();
        System.out.println("========================================================================");
        proxy.sum(3,2);
        System.out.println("========================================================================");
        proxy.sub(3,2);
        System.out.println("========================================================================");
        proxy.mul(4,2);
        System.out.println("========================================================================");
        proxy.div(4,2);
        System.out.println("========================================================================");
        System.out.println("========================================================================");
        System.out.println("========================================================================");
        System.out.println("=========================通过jdk实现动态代理=================================");
        UserService target1 = new UserService();
        JdkProxy jdkProxy = new JdkProxy(target1);
        InterfaceProxy proxy1 = jdkProxy.getProxy();
        System.out.println("========================================================================");
        proxy1.login("admin","123456");
        System.out.println("========================================================================");
        proxy1.register("admin","123456",23);
    }
}
